import request from '@/utils/request'

export function uploadPicture(files){
	return request({
		url: '/house/uploadPicture',
		method: 'get',
		files
	})
}

export function getNewHouse(i) {
	return request({
		url: '/house/getNewHouse?i=' + i,
		method: 'get'
	})
}

export function getHouseByPage(currentPage, pageSize) {
	return request({
		url: '/house/getHouseByPage',
		method: 'get',
		params: {
			currentPage,
			pageSize
		}
	})
}

export function getHouseById(id) {
	return request({
		url: '/house/getHouseById',
		method: 'get',
		params: {
			id
		}
	})
}

export function getMyHouse() {
	return request({
		url: '/house/getMyHouse',
		method: 'get'
	})
}

export function createHouseByUser(data) {
	return request({
		url: '/house/createHouseByUser',
		method: 'post',
		data
	})
}

export function removePicture(fileName) {
	return request({
		url: '/house/removePicture',
		method: 'get',
		params: {
			fileName
		}
	})
}

export function getHouseByPageAsFilter(currentPage, pageSize, zone, price, area) {
	return request({
		url: '/house/getHouseByPageAsFilter',
		method: 'get',
		params: {
			currentPage,
			pageSize,
			zone,
			price,
			area
		}
	})
}

export function getVillage(){
	return request({
		url: '/house/getVillage',
		method: 'get'
	})
}

export function searchHouseByVillage(village){
	return request({
		url: '/house/searchHouseByVillage',
		method: 'get',
		params:{
			village
		}
	})
}

export function deleteHouse(data){
	return request({
		url: '/house/deleteHouse',
		method: 'post',
		data
	})
}
